'use strict';
/* jshint mocha: true */
var _ = require('lodash');
var expect = require('chai').expect;
var Injector = require('../');

describe('test-define', function () {
    it('It should return function', function () {
        var moduleDefinition = Injector.define([], function () {
        });
        expect(moduleDefinition).to.be.a('object');
        expect(moduleDefinition).to.have.property('load');
    });
    it('It should throw errr when pass invalid params', function () {
        var func = function () {};
        expect(function () {
            Injector.define([], func);
        }).to.not.throw(TypeError);
        expect(function () {
            Injector.define(['a1_2-3/a2_2-3'], func);
        }).to.not.throw(TypeError);
        expect(function () {
            Injector.define(['a1_2-3/a2_2-3', 'a1_2-3/a2_2-3'], func);
        }).to.not.throw(TypeError);
        expect(function () {
            Injector.define(['a1_2-3/a2_2-3/'], func);
        }).to.throw(TypeError);
        expect(function () {
            Injector.define([]);
        }).to.throw(TypeError);
        expect(function () {
            Injector.define([], {});
        }).to.throw(TypeError);
        expect(function () {
            Injector.define([''], func);
        }).to.throw(TypeError);
        _.each([' ', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '=', '+', '\'', '"', ';', ':', '<', '>', '?', ',', '.', '`', '~', '|', '\\'], function (letter) {
            expect(function () {
                Injector.define(['a'+letter], func);
            }).to.throw(TypeError);
        });
    });
});